<template>
    <div>
        <h3>添加会员等级</h3>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>会员等级</td>
                    <td><input type="text" v-model="Query.LvName"></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="添加" @click="add" class="btn btn-primary">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import axios from 'axios';
import moment from 'moment';
import { useRoute, useRouter } from 'vue-router';
const Route = useRoute();
const Router = useRouter();

let Query: any = reactive({
    "LvName": ''
})

const add = () => {
    if (Query.LvName == "") {
        alert("会员等级不能为空");
        return;
    }
    axios({
        url: '/api/VIP/AddVIPLv',
        method: 'post',
        params: Query
    })
        .then((res) => {
            console.log(res);
            if (res.data == -1) {
                alert("会员等级已存在");
                return;
            }
            else if (res.data > 0) {
                alert("添加成功");
                return;
            }
            else {
                alert("添加失败");
                return;
            }

        })
        .catch((err) => {
            console.log(err);

        })
}





</script>

<style scoped></style>